package com.whq.knowverywell.business.model;

/**
 * 店柜的销售记录
 * 
 * @author wanghuaiqiang
 * 
 */
public class ProductSalesRecord extends BaseSalesRecord {
	/**
	 * 商品图片
	 */
	private String imageUrl = "";

	/**
	 * 平均折扣,9代表9折
	 */
	private double averageDiscount = 0;

	/**
	 * 不打折的金额
	 */
	private double fullPayment = 0l;

	/**
	 * 库存
	 */
	private long stockQty = 0;
	
	/**
	 * 颜色
	 */
	private String colorCode = "";
	
	/**
	 * 尺码
	 */
	private String sizeCode = "";
	
	/**
	 * 吊牌价
	 */
	private double priceTag = 0;
	
	/**
	 * 获取款号，商品的条形码去掉颜色和尺码
	 * @return
	 */
	public String getPropertyCode() {
		if (this.getCode() == null) {
			return "";
		}
		if ( (this.sizeCode == null) || ("-".equals(this.sizeCode)) ) {
			this.sizeCode = "";
		}
		if ( (this.colorCode == null) || ("-".equals(this.colorCode)) ) {
			this.colorCode = "";
		}
		int colorSizeCodeLength = this.sizeCode.length() + this.colorCode.length();
		int totalLenth = this.getCode().length();
		if ( (colorSizeCodeLength <= 0) || (totalLenth < colorSizeCodeLength) ){
			return this.getCode();
		}
		return this.getCode().substring(0, (totalLenth - colorSizeCodeLength));
	}
	
	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public double getAverageDiscount() {
		return averageDiscount;
	}

	public void setAverageDiscount(double averageDiscount) {
		this.averageDiscount = averageDiscount;
	}

	public double getFullPayment() {
		return fullPayment;
	}

	public void setFullPayment(double fullPayment) {
		this.fullPayment = fullPayment;
	}

	public long getStockQty() {
		return stockQty;
	}

	public void setStockQty(long stockQty) {
		this.stockQty = stockQty;
	}

	public String getColorCode() {
		return colorCode;
	}

	public void setColorCode(String colorCode) {
		this.colorCode = colorCode;
	}

	public String getSizeCode() {
		return sizeCode;
	}

	public void setSizeCode(String sizeCode) {
		this.sizeCode = sizeCode;
	}

	public double getPriceTag() {
		return priceTag;
	}

	public void setPriceTag(double priceTag) {
		this.priceTag = priceTag;
	}

}
